import axios from 'poros/http';
// const BASE_API = 'http://10.110.96.81:8030';
const BASE_API = '';
// 分页查询商机列表
export const postBusinessList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunity/listByPage`,
    method: 'post',
    data,
  });
// 商机保存接口
export const postBusinessSave = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunity/insert`,
    method: 'post',
    data,
  });
// 商机新增接口
export const postBusinessAdd = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunity/affirm`,
    method: 'post',
    data,
  });
// 商机详情接口
export const getBusinessDetail = opportunityNo =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunity/getByOpportunityNo/${opportunityNo}`,
    method: 'get',
  });
// 获取流程Id接口
export const postCreateOrUpdate = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/process/createOrUpdate`,
    method: 'post',
    data,
  });
// 转他人处理接口
export const postBusinessForward = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunity/forward`,
    method: 'post',
    data,
  });
// 操作日志
export const getOperationLog = (type, id) =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/log/query/${type}/${id}`,
    method: 'get',
  });
// 查询流程节点
export const getProcessNode = (processId, code) =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/processNode/getSingleNodeApprovalProcess/${processId}/${code}`,
    method: 'get',
  });
// 批量删除
export const postDeleteBusiness = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunity/delete`,
    method: 'post',
    data,
  });
// 导出商机
export const postBusinessBizSnapshoot = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunity/export`,
    method: 'post',
    responseType: 'arraybuffer',
    hasInterceptors: true,
    data,
  });
// 商机关联产品
export const postBusinessProduct = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityProduct/batchInsert`,
    method: 'post',
    data,
  });
// 查询关联产品
export const postBusinessProductList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityProduct/list`,
    method: 'post',
    data,
  });
// 删除关联产品
export const postBusinessProductDelete = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityProduct/delete`,
    method: 'post',
    data,
  });
// 关联联系人
export const postBusinessContact = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityContact/batchInsert`,
    method: 'post',
    data,
  });
// 查询商机联系人
export const postBusinessContactList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityContact/list`,
    method: 'post',
    data,
  });
// 删除关联联系人
export const postBusinessContactDelete = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityContact/delete`,
    method: 'post',
    data,
  });
// 关联销售团队
export const postBusinessSalesTeam = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunitySalesTeam/batchInsert`,
    method: 'post',
    data,
  });
// 查询销售团队
export const postBusinessSalesList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunitySalesTeam/list`,
    method: 'post',
    data,
  });
// 删除关联销售团队
export const postBusinessSalesDelete = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunitySalesTeam/delete`,
    method: 'post',
    data,
  });
// 查询拜访列表
export const postBusinessVisit = (no, type) =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/visit/findOppOrLeads?no=${no}&type=${type}`,
    method: 'post',
  });
// 删除拜访
export const postBusinessVisitDelete = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityVisit/delete`,
    method: 'post',
    data,
  });
// 查询合同列表
export const postBusinessContractList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityContract/list`,
    method: 'post',
    data,
  });
// 删除合同
export const postBusinessContractDelete = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityContract/delete`,
    method: 'post',
    data,
  });
// 商机审核
export const postBusinessAudit = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunity/audit`,
    method: 'post',
    data,
  });
// 删除附件
export const getAttachmentDelete = id =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/attachment/delete/${id}`,
    method: 'get',
  });
// 转派销售
export const postBusinessTransfer = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityTransfer/insert`,
    method: 'post',
    data,
  });
// 商机转派审核列表
export const postBusinessTransferList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityTransfer/listByPage`,
    method: 'post',
    data,
  });
// 商机转派审核详情
export const postBusinessTransferDetail = transferNo =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityTransfer/getOpportunityTransfer/${transferNo}`,
    method: 'get',
  });
// 商机转派转他人处理
export const postBusinessTransForward = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityTransfer/forward`,
    method: 'post',
    data,
  });
// 商机转派审核
export const postBusinessTransAudit = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityTransfer/auditLeadsTransfer`,
    method: 'post',
    data,
  });
// 商机转派撤回
export const postBusinessTransferRecall = id =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/opportunityTransfer/recall/${id}`,
    method: 'get',
  });
// 上传附件
export const postUploadFile = (type, id, file, attPoint) => {
  const formData = new FormData();
  formData.append('file', file);
  return axios({
    url: `${BASE_API}/api/salesforecast-service/attachment/upload/${type}/${attPoint}/${id}`,
    headers: { 'Content-Type': 'multipart/form-data' },
    method: 'post',
    data: formData,
  });
};
// 商机子阶段保存
export const saveBatchOppySubStage = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/stage/saveBatchOppySubStage`,
    method: 'post',
    data,
  });
// 商机子阶段删除
export const postSubStagedelete = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/stage/delete`,
    method: 'post',
    data,
  });
// 商机子阶段列表
export const postSubStagelist = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/stage/list`,
    method: 'post',
    data,
  });
// 商机逾期报警
export const postOverdueBusinessList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/OverdueBusinessOpportunity/list`,
    method: 'post',
    data,
  });
// 导出商机预警报表
export const postlistExportTemplate = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/OverdueBusinessOpportunity/listExportTemplate`,
    method: 'post',
    responseType: 'arraybuffer',
    hasInterceptors: true,
    data,
  });
